Ext.ux.PreDelete = Ext.extend(Ext.Window, {
	msgData:{},
	who:'',
	categoryName:'',
	whoValue:'',
	categoryId:'',
	deleteMode:'',
	initComponent : function(config) {
		var whoCategory = this.who;
		var wValue = this.whoValue;
		var cid = this.categoryId;
		var cvalue = this.categoryValue;
		var dMode = this.deleteMode;
		
		function parseResult(r, who) {
			var str = '类别名称--:--类别下-' + who + '-的数量<br/>';
			if(r.msg == 'has') {
				if(r.list != null) {
					if(r.list.length >= 1) {
						for(var i=0; i<r.list.length; i++) {
							str += r.list[i].name + '--:-:-:--' + r.list[i].count + '<br/>';
						}
					}
				}
			}
			return str;
		}
		
		var panel = {
			title: '要删除的-' + this.categoryName + '-下子类别和类别下-' + whoCategory + '-的数量',
            xtype: 'fieldset',
            height: '100%',
			region : 'center',
			autoScroll:true,
			html: parseResult(this.msgData, this.who)
		};
		
		Ext.apply(this, {
			title: "提示信息",
	        plain: true,
	        width:400,
	        height:300,
	        modal: true,
	        maximizable:true,
	        border: false,
	        layout: 'border',
	        bbar:['->', {
	        	text:'确定删除',
	        	handler:function() {
	        		Ext.Msg.confirm("警告", "删除该类别将删除该类别下的子类<br/>" +
	        		"以及所属该类别的全部-" + whoCategory + "-，你确删除吗？",
	        		function(btn) {
	        			if (btn == 'yes') {
	        				ajaxDeleteCategory(cid, wValue, dMode);
	        			}
	        		});
	        	}
	        }, '-', {
	        	text:'取消',
	        	handler:function() {
	        		Ext.getCmp('preDelete').close();
	        	}
	        }],
	        items:[panel]
		});
		Ext.ux.PreDelete.superclass.initComponent.apply(this, arguments);
	}
});
Ext.reg('lgnPreDelete', Ext.ux.PreDelete);
